package com.xiaoxing.zhinenghuacangku_zhijian.mvp.ui.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.jess.arms.base.BaseActivity;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils;
import com.xiaoxing.zhinenghuacangku_zhijian.R;
import com.xiaoxing.zhinenghuacangku_zhijian.R2;
import com.xiaoxing.zhinenghuacangku_zhijian.di.component.DaggerQuYangGongNengXuanZeComponent;
import com.xiaoxing.zhinenghuacangku_zhijian.di.module.QuYangGongNengXuanZeModule;
import com.xiaoxing.zhinenghuacangku_zhijian.mvp.contract.QuYangGongNengXuanZeContract;
import com.xiaoxing.zhinenghuacangku_zhijian.mvp.presenter.QuYangGongNengXuanZePresenter;
import com.xiaoxing.zhinenghuacangku_zhijian.mvp.ui.entity.QuYangGongNengXuanZe;

import java.util.HashMap;

import butterknife.OnClick;
import com.jess.arms.utils.CProgressDialogUtils;
import me.jessyan.armscomponent.commonres.utils.ToolbarUtils;
import me.jessyan.armscomponent.commonsdk.core.RouterHub;
import me.jessyan.armscomponent.commonsdk.utils.Utils;

import static com.jess.arms.utils.Preconditions.checkNotNull;


@Route(path = RouterHub.ZHI_NENG_HUA_CANG_KU_ZHI_JIAN_ACTIVITY_QU_YANG_GONG_NENG_XUAN_ZE)
public class QuYangGongNengXuanZeActivity extends BaseActivity<QuYangGongNengXuanZePresenter> implements QuYangGongNengXuanZeContract.View {


    @Override
    public void setupActivityComponent(@NonNull AppComponent appComponent) {
        DaggerQuYangGongNengXuanZeComponent //如找不到该类,请编译一下项目
                .builder()
                .appComponent(appComponent)
                .quYangGongNengXuanZeModule(new QuYangGongNengXuanZeModule(this))
                .build()
                .inject(this);
    }

    @Override
    public int initView(@Nullable Bundle savedInstanceState) {
        return R.layout.activity_qu_yang_gong_neng_xuan_ze; //如果你不需要框架帮你设置 setContentView(id) 需要自行设置,请返回 0
    }

    @Override
    public void initData(@Nullable Bundle savedInstanceState) {

        ToolbarUtils.initToolbarTitleBack(this, getString(R.string.activity_qu_yang_gong_neng_xuan_ze));
        //getQuYangGongNengXuanZeData();
    }

    @OnClick(R2.id.btn_shen_qing_qu_yang)
    public void btnShenQingQuYang() {
        Utils.navigation(this, RouterHub.ZHI_NENG_HUA_CANG_KU_ZHI_JIAN_ACTIVITY_QU_YANG_LIE_BIAO);
    }

    @OnClick(R2.id.btn_qu_yang_cao_zuo)
    public void btnQuYangCaoZuo() {
        Utils.navigation(this, RouterHub.ZHI_NENG_HUA_CANG_KU_ZHI_JIAN_ACTIVITY_QU_YANG_CAO_ZUO);
    }

    @Override
    public void getQuYangGongNengXuanZeDataSuccess(QuYangGongNengXuanZe entityData) {


    }

    private void getQuYangGongNengXuanZeData() {
        HashMap<String, String> map = new HashMap<>();

        mPresenter.getQuYangGongNengXuanZeData(map);
    }


    @Override
    public void showLoading() {
        CProgressDialogUtils.showProgressDialog(this);
    }

    @Override
    public void hideLoading() {
        CProgressDialogUtils.cancelProgressDialog(this);
    }

    @Override
    public void showMessage(@NonNull String message) {
        checkNotNull(message);
        ArmsUtils.makeText(this, message);
    }

    @Override
    public void launchActivity(@NonNull Intent intent) {
        checkNotNull(intent);
        ArmsUtils.startActivity(intent);
    }

    @Override
    public void killMyself() {
        finish();
    }
}
